/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package session;

import entities.Cliente;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import session.exceptions.LoginException;

/**
 *
 * @author sflesca
 */
@Stateless
public class UserManager implements UserManagerLocal {
    @EJB
    private ClienteFacade clienteFacade;

    @Override
    public Cliente login(String cognome, String nome) throws LoginException {
        Cliente x = clienteFacade.findCliente(cognome, nome);
        if(x==null) throw new LoginException("Cliente non trovato o non unico");
        return x;
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
